using System;

namespace DevFramework.Entities.Concrete
{
    public class OrderDetail
    {
        public OrderDetail()
        {
            Quantity = 1;
        }

        public virtual int OrderId { get; set; }

        public virtual int ProductId { get; set; }

        public virtual decimal UnitPrice { get; set; }

        public virtual short Quantity { get; set; }

        public override bool Equals(object obj)
        {
            var toCompare = obj as OrderDetail;

            if (toCompare == null)
            {
                return false;
            }

            if (!Object.Equals(this.OrderId, toCompare.OrderId))
                return false;
            if (!Object.Equals(this.ProductId, toCompare.ProductId))
                return false;

            return true;
        }

        public override int GetHashCode()
        {
            int hashCode = 13;
            hashCode = (hashCode * 7) + OrderId.GetHashCode();
            hashCode = (hashCode * 7) + ProductId.GetHashCode();
            return hashCode;
        }
    }
}